score <- function(dat, reverse = NULL, limits = NULL, mean = TRUE,
  reliability = FALSE, na.rm = TRUE, ...) {

  if (!mean && na.rm) {
    na.rm <- FALSE
    warning("Summing is not meaningful for missing values. ",
            "'na.rm' set to FALSE.", call. = FALSE)
  }

  ## Setup and appropriateness tests
  if (any(limits < 0) && !is.null(rev)) {
    stop("Cannot reverse score scale that can take on negative values.")
  }
  if (!is.matrix(dat) || !is.data.frame(dat)) {
    dat <- as.data.frame(dat)
  }
  stopifnot(unlist(lapply(dat, is.numeric)))

  ## Reverse specified variables or columns
  if (!is.null(reverse)) {
    dat[, reverse] <- (dat[, reverse] * (-1)) + sum(limits)
  }

  ## Find the mean or sum
  if (mean) {
    value <- rowMeans(dat, na.rm = na.rm)
  } else {
    value <- rowSums(dat, na.rm = na.rm)
  }

  if (reliability) {
    reliability <- omega(m = dat, plot = FALSE, ...)
  } else {reliability <- NULL}
  output <- list(score = value, reliability = reliability)

  return(output)
}
